home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 4
/
FM Towns Free Software Collection 4 - Disc 1.iso
/
msdos
/
mcpr
/
mcpfrm.asm
< prev
next >
Wrap
Assembly Source File
|
1991-10-18
|
6KB
|
342 lines
page 95,132
;§∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞§
;§ §
;§ マルチカラム コンパクト プリント ユーティリティ §
;§ §
;§ Multicolumn Compact PRint utility MCPR.EXE Ver1.40 §
;§ ~ ~ ~~ §
;§ Copyright (C) by 福地 邦雄 1989-1990. All rights reserved. §
;§∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞§
public formprint
public inline
public curclm
public curlin
public curblk
public curpage
public linumber
public printend
public hdrpgnum
public hdrlinoff
public hdrlinseg
public hdrln2seg
public linptr
extrn initvaliable:near
extrn initpgbuff:near
extrn reducepagebuff:near
extrn getchar:near
extrn ungetchar:near
extrn fillineproc:near
extrn filgapproc:near
extrn hdrpgupdate:near
extrn codeprint:near
extrn bitprint:near
extrn setlinumber:near
extrn feedprint:near
;
YES equ 1
NO equ 0
TAB equ 9
CR equ 0dh
LF equ 0ah
FF equ 0ch
DEL equ 7fh
;
data segment para public 'DATA'
;
extrn startpage:word
extrn lastpage:word
extrn clmcnt:word
extrn lincnt:word
extrn blkcnt:word
extrn formfeed:word
extrn hdrprint:word
extrn linumb:word
extrn numclm:word
extrn clmpitch:word
extrn tabcount:word
extrn pageproc:word
;
linumber dw ?
curclm dw ?
curlin dw ?
curblk dw ?
curpage dw ?
inline dw ?
srcoff dw ?
printend dw ?
feedwork dw ?
;
lchclm dw ?
;
hdrpgnum dw ?
hdrlinoff dw 0
hdrlinseg dw 0
dw 0
hdrln2seg dw 0
linptr dd 256 dup(?)
;
linbuf db 410h dup(?)
;
data ends
;
code segment para public 'CODE'
assume cs:code,ds:data
;
formprint proc
;
cld
call initvaliable
call initpgbuff
makepageloop:
inc linumber
call fgets
jz lineproc
jmp endoffile
lineproc:
mov si,offset linbuf
call [pageproc]
jnz makepageloop
;
mov si,offset linbuf
mov srcoff,si
cmp byte ptr [si],FF
jne nofeed
inc srcoff
mov al,' '
mov bx,curlin
test bx,bx
jz nofeed
mov dx,lincnt
sub dx,bx
ja setspc
jmp nextcolums
setspc:
shl bx,1
shl bx,1
add bx,offset linptr
mov si,clmcnt
cmp linumb,YES
jne feedloop
add si,numclm
inc si
feedloop:
mov cx,si
les di,[bx]
rep stosb
mov [bx],di
lea bx,[bx+4]
dec dx
jnz feedloop
jmp nextcolums
nofeed:
mov curclm,0
call setlinumber
mov si,srcoff
copyline:
lodsb
test al,al
jz eol
mov cx,curclm
cmp cx,clmcnt
jae foldline
cmp al,81h
jb cpyank
cmp al,0a0h
jb cpyknj
cmp al,0e0h
jb cpyank
cpyknj:
inc cx
cmp cx,clmcnt
jae foldline
mov ah,al
lodsb
xchg ah,al
stosw
add curclm,2
jmp short copyline
cpyank:
stosb
inc curclm
jmp short copyline
eol:
mov inline,NO
foldline:
dec si
mov srcoff,si
call fillineproc
inc curlin
mov ax,curlin
cmp ax,lincnt
jae nextcolums
jmp lbfchk
nextcolums:
mov curlin,0
inc curblk
mov ax,curblk
cmp ax,blkcnt
jae pageend
;
call filgapproc
jmp lbfchk
endoffile:
mov printend,YES
pageend:
mov curblk,0
mov ax,curpage
cmp ax,startpage
jb pageskip
call reducepagebuff
jz noprint
mov feedwork,ax
cmp clmpitch,3
je bitimgprt
call codeprint
jmp short prtend
bitimgprt:
call bitprint
prtend:
mov ax,feedwork
call feedprint
pageskip:
call initpgbuff
noprint:
cmp printend,NO
jne filend
inc curpage
call hdrpgupdate
mov ax,curpage
cmp ax,lastpage
ja filend
lbfchk:
mov si,srcoff
cmp byte ptr [si],0
jne existlbf
jmp makepageloop
existlbf:
jmp nofeed
filend:
ret
;
formprint endp
;
fgets proc
;
mov lchclm,0
mov di,ds
mov es,di
mov di,offset linbuf
;
makelineloop:
cmp di,(offset linbuf)+400h
jb nextchar
jmp endofline
nextchar:
call getchar
jnz endofline
;
cmp al,' '
jb codectrl
cmp al,DEL
jb codeank
cmp al,81h
jb codeskip
cmp al,0a0h
jb codekanji
cmp al,0e0h
jb codeank
cmp al,0fch
jbe codekanji
codeskip:
jmp short makelineloop
codeank:
stosb
inc lchclm
jmp short makelineloop
codectrl:
cmp al,TAB
jne chckff
call tabproc
jmp short makelineloop
chckff: cmp al,FF
jne chcklf
cmp lchclm,0
jne existchr
cmp curlin,0
je makelineloop
cmp formfeed,YES
jne endofline
cmp di,offset linbuf
jne makelineloop
stosb
jmp short makelineloop
existchr:
cmp formfeed,YES
je eolunget
jmp short endofline
chcklf: cmp al,LF
je endofline
cmp al,CR
jne makelineloop
reinput:
call getchar
jnz endofline
cmp al,0ah
je endofline
cmp al,0dh
je reinput
eolunget:
call ungetchar
endofline:
xor al,al
stosb
cmp lchclm,0
je eofchk
xor ax,ax
eofchk:
test ax,ax
ret
;
codekanji:
mov dl,al
call getchar
cmp al,40h
jb undefcode
cmp al,7fh
je undefcode
cmp al,0fch
ja undefcode
mov ah,al
mov al,dl
jmp short setwcode
undefcode:
mov ax,' '
setwcode:
stosw
add lchclm,2
jmp makelineloop
;
fgets endp
;
tabproc proc
;
mov al,' '
mov cx,lchclm
add cx,tabcount
xchg ax,cx
push dx
cwd
div tabcount
mul tabcount
pop dx
xchg ax,cx
sub cx,lchclm
add lchclm,cx
rep stosb
ret
;
tabproc endp
;
code ends
end